Hello,
Module m
m = current
User currUser = null
string Uname = null
AccessRec ar
currUser = find()
Uname = currUser.name
if (Uname != "constance.walker")
{
ack "Only the constance.walker user can run this script"
halt
}
for ar in all m do
{
if (Uname != "constance.walker")
{unset(m, username(ar))}
}
Permission all = read|create|modify|delete|control
set(m, all, "benny.buscato") // Set UserGroup/User
set(m, read|modify, "IV&V Engineer") // Set UserGroup/User
set(m, read, "Application Engineer") // (R)
set(m, read, null) // Everyone else (R)
unset(m, Uname)
SystemAdmin - Wed Jan 11 13:24:49 EST 2012 |
Re: Is there a way of improving the script (changing permissions) Check if the current user has the rights and the power (module open Edit):
To make sure the module is not inherited, add:
It feels wrong to me to want to remove your own "A" access to the module so I wonder about your last line "unset". It feels better to me to avoid user specific accesses to something, unless you need to stop the destructive power of a particular individual; and if so you should have some Admin group and see if the current user is a member of it. -Louie Haven't done it yet but I figure to provide Database admins "RA" access to everything. This stops them, meaning me, from fat fingering a fatal mistake and destroying something, such as running my "PurgeAll.dxl" script. If I NEED to change something I can use my universal "A" rights to add myself to the appropriate group that has RMCD access, then remove myself afterwards. |
Re: Is there a way of improving the script (changing permissions) llandale - Wed Jan 11 15:06:46 EST 2012
To make sure the module is not inherited, add:
It feels wrong to me to want to remove your own "A" access to the module so I wonder about your last line "unset". It feels better to me to avoid user specific accesses to something, unless you need to stop the destructive power of a particular individual; and if so you should have some Admin group and see if the current user is a member of it. -Louie Haven't done it yet but I figure to provide Database admins "RA" access to everything. This stops them, meaning me, from fat fingering a fatal mistake and destroying something, such as running my "PurgeAll.dxl" script. If I NEED to change something I can use my universal "A" rights to add myself to the appropriate group that has RMCD access, then remove myself afterwards.
I add your suggested code. for the last "unset" I want access removed for all engineers including the lead when it is handed off to the IV&V group. I don't believe you can just have "RA" access inless you know of a trick to set that level of permissions.
Module m
m = current
User currUser = null
string Uname = null
string err = null
string HN = "???????????" // Hainan Database ID
AccessRec ar
currUser = find()
Uname = currUser.name
if(Uname != "constance.walker" && Uname != "benny.buscato" && HN == getDatabaseIdentifier())
{
ack "Only the constance.walker user can run this script and/or not must be run against the Hainan Database"
halt
}
if(Uname == "constance.walker")
{
if(canControl(m))
{
specific(m)
for ar in all m do
{
if (!isDefault( ar ) && username(ar) != "constance.walker")
{err = unset(m, username(ar))
if (!null err){infoBox(err)}}
}
Permission all = read|create|modify|delete|control
err = set(m, all, "benny.buscato") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read|modify, "IV&V Engineer") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read, "Application Engineer") // (R)
if (!null err){infoBox(err)}
err = set(m, read, null) // Everyone else (R)
if (!null err){infoBox(err)}
err = unset(m, Uname)
if (!null err){infoBox(err)}
save(m)
}
} else if(Uname == "benny.buscato")
{
if(canControl(m))
{
specific(m)
for ar in all m do
{
if (!isDefault( ar ) && username(ar) != "benny.buscato")
{err = unset(m, username(ar))
if (!null err){infoBox(err)}}
}
Permission all = read|create|modify|delete|control
err = set(m, all, "constance.walker") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read|create, "Application Engineer") // Set UserGroup/User
if (!null err){infoBox(err)}
err = setImplied(m, modify|delete) // Propagate access rights (RCMD)
if (!null err){infoBox(err)}
err = set(m, read, "IV&V Engineer") // (R)
if (!null err){infoBox(err)}
err = unset(m, Uname)
if (!null err){infoBox(err)}
save(m)
}
} else
{
// For future code!
}
|
Re: Is there a way of improving the script (changing permissions) SystemAdmin - Wed Jan 11 16:57:51 EST 2012
I add your suggested code. for the last "unset" I want access removed for all engineers including the lead when it is handed off to the IV&V group. I don't believe you can just have "RA" access inless you know of a trick to set that level of permissions.
Module m
m = current
User currUser = null
string Uname = null
string err = null
string HN = "???????????" // Hainan Database ID
AccessRec ar
currUser = find()
Uname = currUser.name
if(Uname != "constance.walker" && Uname != "benny.buscato" && HN == getDatabaseIdentifier())
{
ack "Only the constance.walker user can run this script and/or not must be run against the Hainan Database"
halt
}
if(Uname == "constance.walker")
{
if(canControl(m))
{
specific(m)
for ar in all m do
{
if (!isDefault( ar ) && username(ar) != "constance.walker")
{err = unset(m, username(ar))
if (!null err){infoBox(err)}}
}
Permission all = read|create|modify|delete|control
err = set(m, all, "benny.buscato") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read|modify, "IV&V Engineer") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read, "Application Engineer") // (R)
if (!null err){infoBox(err)}
err = set(m, read, null) // Everyone else (R)
if (!null err){infoBox(err)}
err = unset(m, Uname)
if (!null err){infoBox(err)}
save(m)
}
} else if(Uname == "benny.buscato")
{
if(canControl(m))
{
specific(m)
for ar in all m do
{
if (!isDefault( ar ) && username(ar) != "benny.buscato")
{err = unset(m, username(ar))
if (!null err){infoBox(err)}}
}
Permission all = read|create|modify|delete|control
err = set(m, all, "constance.walker") // Set UserGroup/User
if (!null err){infoBox(err)}
err = set(m, read|create, "Application Engineer") // Set UserGroup/User
if (!null err){infoBox(err)}
err = setImplied(m, modify|delete) // Propagate access rights (RCMD)
if (!null err){infoBox(err)}
err = set(m, read, "IV&V Engineer") // (R)
if (!null err){infoBox(err)}
err = unset(m, Uname)
if (!null err){infoBox(err)}
save(m)
}
} else
{
// For future code!
}
Thought they allowed RA, see its RMCA (you can suppress delete rights).
I would promote canControl:
"specific" returns an error as well. err=specific(mod); if (!null err) {ack; halt}
void SetModAccess(Module m, Permission psn, string NameUser)
{ string err = set(m, psn, NameUser) // Set UserGroup/User
if (!null err)
errorBox(err)
} // end SetModAccess()
|
Re: Is there a way of improving the script (changing permissions) llandale - Wed Jan 11 17:45:02 EST 2012
Thought they allowed RA, see its RMCA (you can suppress delete rights).
I would promote canControl:
"specific" returns an error as well. err=specific(mod); if (!null err) {ack; halt}
void SetModAccess(Module m, Permission psn, string NameUser)
{ string err = set(m, psn, NameUser) // Set UserGroup/User
if (!null err)
errorBox(err)
} // end SetModAccess()
"Thought they allowed RA, see its RMCA (you can suppress delete rights)." I don't see how you can do this using DXL. I can do it within DOORS GUI. Am I just missing something in the DXL manaul? Thank you, Jim |
Re: Is there a way of improving the script (changing permissions) SystemAdmin - Wed Jan 11 18:20:54 EST 2012 This gives the current object "RMCA" access for "Everyone else" Object o = current specific(o) set(o, control, "")
|